package com.jimikongjian.dao;

import com.jimikongjian.models.ApplicationInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by fuxiuyang on 17/2/20.
 */
public interface IApplicationInfo {

    /**
     * 通过申请表中的id号，获取申请信息
     * @param id
     * @return List<ApplicationInfo>
     */
    public List<ApplicationInfo> getApplicationListById(@Param("id")int id);

    /**
     * 通过申请表中的id号，获取唯一的申请信息
     * @param id
     * @return ApplicationInfo
     */
    public ApplicationInfo getApplicationById(@Param("id") int id);

    /**
     * 通过申请者的id，获取其申请消息
     * @param applicatorId
     * @param start
     * @param length
     * @return List<ApplicationInfo>
     */
    public List<ApplicationInfo> getApplicationListByApplicatorId(@Param("applicatorId") int applicatorId,
                                                                  @Param("start") int start,
                                                                  @Param("length")int length);

    /**
     * 通过申请者的id，获取其申请消息
     * @param applicatorId
     * @param start
     * @param length
     * @return List<ApplicationInfo>
     */
    public List<ApplicationInfo> getUnreadApplicationListByApplicatorId(@Param("applicatorId") int applicatorId,
                                                                        @Param("start") int start,
                                                                        @Param("length")int length);

    /**
     * 通过创建者的id号，获取申请创建者创建的空间的申请者的信息
     * @param roomCreator
     * @param start
     * @param length
     * @return List<ApplicationInfo>
     */
    public List<ApplicationInfo> getApplicationListByRoomCreator(@Param("roomCreator") int roomCreator,
                                                                 @Param("start") int start,
                                                                 @Param("length")int length);

    /**
     * 通过创建者的id号，获取申请创建者创建的空间的申请者的信息
     * @param roomCreator
     * @param start
     * @param length
     * @return List<ApplicationInfo>
     */
    public List<ApplicationInfo> getUnreadApplicationListByRoomCreator(@Param("roomCreator") int roomCreator,
                                                                       @Param("start") int start,
                                                                       @Param("length")int length);

    /**
     * 通过创建者的id，获取该创建者未读申请消息的条数
     * @param roomCreator
     * @return
     */
    public List<ApplicationInfo> getUnreadCountByRoomCreator(@Param("roomCreator") int roomCreator);

    /**
     * 创建一条新的用户申请者的消息
     * @param applicationInfo
     */
    public void insertApplication(ApplicationInfo applicationInfo);

    /**
     * 更新申请消息
     * @param applicationInfo
     */
    public void updateApplication(ApplicationInfo applicationInfo);

    /**
     * 删除某一申请消息
     * @param applicationInfo
     */
    public void deleteApplication(ApplicationInfo applicationInfo);
}
